//
//  CustomSearchViewController.m
//  PropertyMananger
//
//  Created by bh on 16/12/29.
//  Copyright © 2016年 BH. All rights reserved.
//

#import "CustomSearchViewController.h"
#import "AttentionController.h"
@interface CustomSearchViewController ()

@end

@implementation CustomSearchViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.view addSubview:self.navBar];
    
}
- (UIView*)navBar
{
    if (!_navBar) {
        _navBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, BHscreenW, 64)];
        _navBar.backgroundColor = Theme_Color;
        // 标题
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 25, BHscreenW-160, 25)];
        self.titleLabel.textColor = [UIColor whiteColor];
        self.titleLabel.font      = BHFont(17);
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.text      = @"查询";
        [_navBar addSubview:self.titleLabel];

        // 返回按钮
//        UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//        //[backBtn setTitle:@"返回" forState:UIControlStateNormal];
//      //  [backBtn setBackgroundImage:IMG(@"ico_return") forState:UIControlStateNormal];
//        [backBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//        [backBtn setFrame:CGRectMake(20, 40, 8, 14)];
//        [backBtn addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
//        [_navBar addSubview:backBtn];
    }
    
    return _navBar;
}
- (void)back
{
    __weak typeof(self)weakSelf = self;
    [self dismissViewControllerAnimated:YES completion:nil];
    self.searchBar.text = @"";
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if ([weakSelf.delegateCustom respondsToSelector:@selector(searchControllerBackButtonClick:)]) {
            [weakSelf.delegateCustom searchControllerBackButtonClick:weakSelf];
        }
    });
}


@end
